<template>
  <el-row type="flex" justify="center" class="block">
    <el-pagination
      :current-page="page"
      :page-sizes="[8, 16, 24, 32]"
      :page-size="size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </el-row>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 0
    },
    page: {
      type: Number,
      default: 1
    },
    size: {
      type: Number,
      default: 8
    }
  },
  data() {
    return {
    }
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      //   this.size = val
      this.$emit('update:size', val)
      this.$emit('handleChange', this.size, this.page)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
      //   this.page = val
      this.$emit('update:page', val)
      this.$emit('handleChange', this.size, this.page)
    }
  }
}
</script>

<style lang='less' scoped >

</style>
